	<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>{$pagetext['0']} - Ace Admin</title>

		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="{__PUBLIC__}assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="{__PUBLIC__}assets/font-awesome/4.5.0/css/font-awesome.min.css" />

		<!-- page specific plugin styles -->

		<!-- text fonts -->
		<link rel="stylesheet" href="{__PUBLIC__}assets/css/fonts.googleapis.com.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="{__PUBLIC__}assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

		
			<link rel="stylesheet" href="{__PUBLIC__}assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
		
		<link rel="stylesheet" href="{__PUBLIC__}assets/css/ace-skins.min.css" />
		<link rel="stylesheet" href="{__PUBLIC__}assets/css/ace-rtl.min.css" />

		
		  <link rel="stylesheet" href="{__PUBLIC__}assets/css/ace-ie.min.css" />
		

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->
		<script src="{__PUBLIC__}assets/js/ace-extra.min.js"></script>

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		
		<script src="{__PUBLIC__}assets/js/html5shiv.min.js"></script>
		<script src="{__PUBLIC__}assets/js/respond.min.js"></script>
		
         <link rel="stylesheet" href="{__PUBLIC__}assets/style.css" />
	</head>


				

			<div class="main-content">
            <div class="col-sm-6">
										<h3 class="header blue lighter smaller">
											<i class="ace-icon fa fa-spinner   bigger-125 " id="donghua"></i>
											采集进度 【状态：<span id="sate">未开始</span>】
										</h3>

										<div class="progress progress-striped pos-rel" data-percent="0%" id="bar_a">
													<div class="progress-bar progress-bar-success" id="bar_b" style="width: 0%;"></div>
												</div>
									</div>
                                    
				 <div style="width:100%; margin-top:10px;">
                 <div class="widget-box"  style="width:95%; margin:0 auto">
												<div class="widget-header">
													<h4 class="widget-title">
														采集设置
													</h4>
												</div>

												<div class="widget-body">
													<div class="widget-main">
														<div class="clearfix">
														开始页：<input type="text" class="ui-spinner-input"  id="p_t" value="1">
                                                        &nbsp;结束页：<input type="text"  id="p_e" class="ui-spinner-input" value="600">
                                                         <button class="btn btn-sm btn-primary" style="margin-top:-3px; margin-left:8px;" id="save" onClick="Gocaiji()">开始采集</button>
														</div>

                                            
                                            </div>
                                            
                                            
                        </div>
                      </div>
                     <div class="well well-sm" style="width:95%; margin:0 auto; margin-top:10px;"> 商品不会重复采集，采集时请勿关闭此窗口！ </div>

			

			<!-- basic scripts -->

		
		<script src="{__PUBLIC__}assets/js/jquery-2.1.4.min.js"></script>

		

		
<script src="{__PUBLIC__}assets/js/jquery-1.11.3.min.js"></script>

		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='{__PUBLIC__}assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
        <script src="{__PUBLIC__}assets/js/ace-extra.min.js"></script>
	<!-- ace scripts -->
	
		<script src="{__PUBLIC__}assets/js/jquery-2.1.4.min.js"></script>

	

		
<script src="{__PUBLIC__}assets/js/jquery-1.11.3.min.js"></script>

		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='{__PUBLIC__}assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="{__PUBLIC__}assets/js/bootstrap.min.js"></script>

		<!-- page specific plugin scripts -->

	
		  <script src="{__PUBLIC__}assets/js/excanvas.min.js"></script>
		
		<script src="{__PUBLIC__}assets/js/jquery-ui.custom.min.js"></script>
		<script src="{__PUBLIC__}assets/js/jquery.ui.touch-punch.min.js"></script>
		<script src="{__PUBLIC__}assets/js/bootbox.js"></script>
		<script src="{__PUBLIC__}assets/js/jquery.easypiechart.min.js"></script>
		<script src="{__PUBLIC__}assets/js/jquery.gritter.min.js"></script>
		<script src="{__PUBLIC__}assets/js/spin.js"></script>

		<!-- ace scripts -->
		<script src="{__PUBLIC__}assets/js/ace-elements.min.js"></script>
		<script src="{__PUBLIC__}assets/js/ace.min.js"></script>




		<!-- inline scripts related to this page -->
        <link rel="stylesheet" href="{__PUBLIC__}global/message/css/jquery.my-message.1.1.css" />
		<script type="text/javascript" src="{__PUBLIC__}global/message/js/jquery.my-message.1.1.js"></script>
        <script src="{__PUBLIC__}global/layer/layer.js"></script>
        <script src="{__PUBLIC__}global/js/Validform_v5.3.2_min.js"></script>
        <script src="{__PUBLIC__}global/js/index.js"></script>
		<script>
		ZhiForm("#form","index.php?r=index/agent/channel","保存中","保存","null");
			$('[data-rel=popover]').popover({container:'body'});

function Gocaiji(){
  $("#save").html("<i class=\"fa fa-spinner\"></i> 采集中");
  $("#save").attr("disabled", true); 
  $("#caiji").css("display","block");
   var p_t=document.getElementById("p_t").value;
   var p_e=document.getElementById("p_e").value;
   var type=$("#type").val()
   for(i=p_t;i<=p_e;i++){
     window.setTimeout("ajaxfun("+p_t+","+p_e+","+i+","+type+")", i * 5000); 
   
   }
   
}


function ajaxfun(p_t,p_e,i,type){
	$.ajax({
	    url:"index.php?r=manage/caiji/yqfgycaiji"+"&t="+p_t+"&e="+p_e+"&nowpage="+i,
         type: 'GET',
         dataType: 'html',
         success: function(data){
			 if(data=='ok'){
				 // $("#now").html(' <strong style="color:green; font-size:16px" id="nowpage">采集任务完成！</strong>');
				 	$("#bar_a").attr("data-percent","100%");
			        $("#bar_b").css("width","100%");
				    $("#save").removeAttr("disabled");
                    $("#save").html("开始采集");
					$("#sate").html("采集完成");
					$("#donghua").removeClass("fa-spin");
			 }else{
				 
				  var nowpage=p_e-i;
			// var html='正在采集第 <strong style="color:red; font-size:16px" id="nowpage">'+i+'</strong> 页 还剩下 <strong style="color:red; font-size:16px">'+nowpage+'</strong> 页,请稍等...';
			var html=(i/p_e)*100;
			$("#bar_a").attr("data-percent",html+"%");
			$("#bar_b").css("width",html+"%");
			 $("#now").html(html);
			 $("#sate").html("进行中...");
			 $("#donghua").addClass("fa-spin");
			 
			 }
			// alert(data);
			 
		 }
   });	
	
}

		</script>
		
	</body>
</html>
